<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        //split 方法按照给定规则分割字符串，返回一个由分割出来的字符串组成的数组
        var name = "it|bai|zhan";
        console.log(name.split("|"));
        console.log(typeof name.split("|"));
        
        //如果分割规则为空字符串，则返回数组的成员是原字符串的每一个字符
        var name = "it|bai|zhan";
        console.log(name.split(""));

        //如果省略参数，则返回数组的唯一成员就是原字符串
        var name = "it|bai|zhan";
        console.log(name.split());

        //split方法还可以接受第二个参数，限定返回数组的最大成员数
        var name = "it|bai|zhan";
        console.log(name.split("|",0));
        console.log(name.split("|",1));
        console.log(name.split("|",2));
        console.log(name.split("|",3));
    </script>
</body>
</html>